package Command;

import Server.Command;
import Server.cmdArguments;

public class ContainsCommand implements Command{
	private cmdArguments args;
	private Integer i;
	private boolean found = false;

	@Override
	public String execute() {
		try {
			i = Integer.parseInt(args.commands[1].trim());	
			found = args.bst.contains(i);
		} catch (Exception e) {
			return "Missing or incorrect argument";
		}		
		if(found){
			return "Yes";
		}		
		return "No";
	}

	@Override
	public String undo() {
		return "The request for a contains can't been undone, please try again";
	}

	@Override
	public void setArgs(cmdArguments args) {
		this.args = args;				
	}
}
